package TransactionImplementation

//更改取消关联事务
//引入类
import (
	"SalaryPayment/AbstractTransaction"
	"SalaryPayment/DataBase"
	"SalaryPayment/Model"
	"SalaryPayment/ModelImplementation"
	"reflect"
)

//结构体
type ChangeUnAffiliationTransaction struct {
	AbstractTransaction.ChangeAffiliationTransaction
}

//记录会员
func (c *ChangeUnAffiliationTransaction) RecordMembership(employee *Model.Employee) {
	af := employee.GetAffiliation()

	if reflect.TypeOf(af) == reflect.TypeOf(ModelImplementation.UnionAffiliation{}) {
		uaf := af.(*ModelImplementation.UnionAffiliation)
		memberId := uaf.GetMemberId()
		DataBase.PayrollDatabase.RemoveUnionMember(memberId)
	}
}

func (c *ChangeUnAffiliationTransaction) GetAffiliation() Model.Affiliation {
	return Model.NoAffiliation{}
}